package com.snowy.hidden.util;

import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class GpsPoint implements Serializable {
    private static final long serialVersionUID = 3584864663880053897L;
    private Double lat;
    private Double lon;

    public GpsPoint(String latitude, String longitude) {
        this.lat = Convert.toDouble(latitude);
        this.lon = Convert.toDouble(longitude);
    }

    public GpsPoint(BigDecimal latitude, BigDecimal longitude) {
        this.lat = latitude.doubleValue();
        this.lon = longitude.doubleValue();
    }

    public String getLatStr() {
        return String.valueOf(this.lat);
    }

    public String getLonStr() {
        return String.valueOf(this.lon);
    }

    @Override
    public String toString() {
        return "GpsPoint{" +
                "lat=" + lat +
                ", lon=" + lon +
                '}';
    }
}
